package br.com.healthy.model.entity;

import java.util.Date;
/**
 * @author Dieb
 *
 */
public class Payment {

	private int id;

	private Date datePayment;
	private Date dateExpiration;
	
	private double value;
	private double rateInterest;
	private double total;
	
	private String description;

	public Payment(int id, Date datePayment, Date dateExpiration,
			double value, double rateInterest, double total, String description) {
		super();
		this.id = id;
		this.datePayment = datePayment;
		this.dateExpiration = dateExpiration;
		this.value = value;
		this.rateInterest = rateInterest;
		this.total = total;
		this.description = description;
	}

	public Payment() {
		super();
	}
	
	/**
	 * @return the id
	 */
	public int getId() {
		return id;
	}

	/**
	 * @param id the id to set
	 */
	public void setId(int id) {
		this.id = id;
	}

	/**
	 * @return the datePayment
	 */
	public Date getDatePayment() {
		return datePayment;
	}

	/**
	 * @param datePayment the datePayment to set
	 */
	public void setDatePayment(Date datePayment) {
		this.datePayment = datePayment;
	}

	/**
	 * @return the dateExpiration
	 */
	public Date getDateExpiration() {
		return dateExpiration;
	}

	/**
	 * @param dateExpiration the dateExpiration to set
	 */
	public void setDateExpiration(Date dateExpiration) {
		this.dateExpiration = dateExpiration;
	}

	/**
	 * @return the value
	 */
	public double getValue() {
		return value;
	}

	/**
	 * @param value the value to set
	 */
	public void setValue(double value) {
		this.value = value;
	}

	/**
	 * @return the rateInterest
	 */
	public double getRateInterest() {
		return rateInterest;
	}

	/**
	 * @param rateInterest the rateInterest to set
	 */
	public void setRateInterest(double rateInterest) {
		this.rateInterest = rateInterest;
	}

	/**
	 * @return the total
	 */
	public double getTotal() {
		return total;
	}

	/**
	 * @param total the total to set
	 */
	public void setTotal(double total) {
		this.total = total;
	}

	/**
	 * @return the description
	 */
	public String getDescription() {
		return description;
	}

	/**
	 * @param description the description to set
	 */
	public void setDescription(String description) {
		this.description = description;
	}
	
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result
				+ ((dateExpiration == null) ? 0 : dateExpiration.hashCode());
		result = prime * result
				+ ((datePayment == null) ? 0 : datePayment.hashCode());
		result = prime * result
				+ ((description == null) ? 0 : description.hashCode());
		result = prime * result + id;
		long temp;
		temp = Double.doubleToLongBits(rateInterest);
		result = prime * result + (int) (temp ^ (temp >>> 32));
		temp = Double.doubleToLongBits(total);
		result = prime * result + (int) (temp ^ (temp >>> 32));
		temp = Double.doubleToLongBits(value);
		result = prime * result + (int) (temp ^ (temp >>> 32));
		return result;
	}
	
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Payment other = (Payment) obj;
		if (dateExpiration == null) {
			if (other.dateExpiration != null)
				return false;
		} else if (!dateExpiration.equals(other.dateExpiration))
			return false;
		if (datePayment == null) {
			if (other.datePayment != null)
				return false;
		} else if (!datePayment.equals(other.datePayment))
			return false;
		if (description == null) {
			if (other.description != null)
				return false;
		} else if (!description.equals(other.description))
			return false;
		if (id != other.id)
			return false;
		if (Double.doubleToLongBits(rateInterest) != Double
				.doubleToLongBits(other.rateInterest))
			return false;
		if (Double.doubleToLongBits(total) != Double
				.doubleToLongBits(other.total))
			return false;
		if (Double.doubleToLongBits(value) != Double
				.doubleToLongBits(other.value))
			return false;
		return true;
	}

	@Override
	public String toString() {
		StringBuilder builder = new StringBuilder();
		builder.append("Payment [id=").append(id).append(", datePayment=")
				.append(datePayment).append(", dateExpiration=")
				.append(dateExpiration).append(", value=").append(value)
				.append(", rateInterest=").append(rateInterest)
				.append(", total=").append(total).append(", description=")
				.append(description).append("]");
		return builder.toString();
	}
	
}
